clear all;

load('avg_dist.mat');
year=87:1:96;
nyear=length(year);
figure('Position',[20,40,800,340],'Color',[1,1,1])
subplot(1,2,1)
axis square
plot(year,avg_dist(:,1),'-b','linewidth',2);
hold on
plot(year,med,'--k','linewidth',2);


title('A. Distance from existing branches','interpreter','latex')
xlabel('year','interpreter','latex')
ylabel('car travel time (min)','interpreter','latex')
set(gca,'fontsize',12)
xlim([87,96])
ylim([0,50])
legend('avg. dist., branches in data','median dist., all unbanked mkts','interpreter','latex','location',[0.297 0.79 0 0])

subplot(1,2,2)
axis square
plot(year,frac_above_low.*100,'-b','linewidth',2);
hold on
plot(year,frac_above_med.*100,'--k','linewidth',2);
hold on
plot(year,frac_above_high.*100,'-.r','linewidth',2);


title([{'B. Fraction of new branches '}, {'far from existing branches'}],'interpreter','latex')
xlabel('year','interpreter','latex')
% ylabel('frac. of new branches opened in the year','interpreter','latex')
ylabel('frac. of new branches in the year (\%)','interpreter','latex')
set(gca,'fontsize',12)
xlim([87,96])
ylim([0,100])
% legend('dist. above 25\% of distribution','dist. above 50\% of distribution','dist. above 75\% of distribution','interpreter','latex')
legend('dist. above 25\%','dist. above 50\%','dist. above 75\%','interpreter','latex','location','southwest')